<script setup>
import { ref } from "vue"
const options = ref([
    {
        index: 1,
        name: "月"
    },
    {
        index: 2,
        name: "季"
    },
    {
        index: 3,
        name: "年"
    }
])

let activeIndex = ref(1)
</script>

<template>
    <div class="picker">
        <div v-for="item in options" :key="item.index" :class="item.index == activeIndex ? 'active' : 'default'"
            @click="activeIndex = item.index">
            <span>{{ item.name }}</span>
        </div>
    </div>
</template>

<style scoped lang="scss">
.picker {
    width: 96px;
    height: 20px;
    display: flex;

    div {
        width: 32px;
        height: 20px;
        box-sizing: border-box;
        border: 1px solid #484B51;
        text-align: center;
        cursor: pointer;

        span {
            line-height: 100%;
            color: #FFFFFF;
            font-size: 10px;
        }
    }

    .active {
        background-color: #484B51;
    }
}
</style>
